package Month11.Day12;

import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import java.io.*;
import java.nio.Buffer;
import java.text.SimpleDateFormat;
import java.util.Scanner;

public class Test07 {
    public static void main(String[] args) {
        FileWriter fw = null;
        BufferedWriter bw = null;
        try {
            fw = new FileWriter("D:\\\\中国玩家\\\\合肥玩家\\\\write.txt");
            bw = new BufferedWriter(fw);
            while (true) {
                Scanner in = new Scanner(System.in);
                System.out.println("输入字符");
                long start = System.currentTimeMillis();
                String a = in.next();
                if (a.equals("quit")) {
                    System.out.println("退出");
                    return;
                } else {
                    long end=System.currentTimeMillis();
                    bw.write(new SimpleDateFormat("hh:mm:ss  ").format(end-start)+a);
                    bw.newLine();
                    bw.flush();
                    System.out.println(new SimpleDateFormat("hh:mm:ss  ").format(end-start)+a);

                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


//        File file = new File("D:\\中国玩家\\合肥玩家\\write.txt");

//        try {
//            file.createNewFile();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        while (true) {
//            Scanner in = new Scanner(System.in);
//            System.out.println("请输入字符");
//            long start=System.currentTimeMillis();
//            String a = in.next();
//            if (a.equals("quit")) {
//                System.out.println("退出");
//                return;
//            } else {
//                long end=System.currentTimeMillis();
//                System.out.println(new SimpleDateFormat("hh:mm:ss  ").format(end-start)+a);
//
//            }






    }

}
